clear all; close all; clc;
R=100;
C=33e-6;
RC=R*C;
Tmod=10*RC;
T=RC/1000;
t= 0:T:Tmod;
E=0*(t<Tmod/4)+3*(t>Tmod/4);

U=nan(1,lenght(t));
dU=nan(1,lenght(t));
U(1)= E(1);dU(1)=0;
U2=U;
for k=2:lenght(t)
    U(k)=U(k-1)+dU(k-1)*T;
    dU(k)=(E(k)-U(k))/RC;
end
figure;
plot(E,t,U,t,U2);
xlabel('t,sec');
ylabel('U,V');
